﻿#region Usings

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ScrumTable.BL.DM.DataManagement;
using ScrumTable.Common;
using ScrumTable.Common.FileSystem;
using ScrumTable.UI.ViewModel;
using Brushes = System.Windows.Media.Brushes;
using Color = System.Windows.Media.Color;
using Image = System.Windows.Controls.Image;
using Point = System.Windows.Point;
using Size = System.Windows.Size;

#endregion

namespace ScrumTable.UI.View.Ink
{
    /// <summary>
    /// InkCanvasUtil
    /// </summary>
    internal class BitmapEncoderContext
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        internal BitmapEncoder Encoder { get; private set; }
        internal string Extension { get; private set; }
        internal string FileName { get; private set; }
        internal string EncoderBasedFileName { get; private set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        internal BitmapEncoderContext(string fileName, string extension, BitmapEncoder encoder)
        {
            PreCondition.AssertNotNullOrEmpty(fileName, "fileName");
            PreCondition.AssertNotNullOrEmpty(extension, "extension");
            PreCondition.AssertNotNull(encoder, "encoder");

            FileName = fileName;
            Extension = extension;
            Encoder = encoder;
            InitializeEncoderBasedFileName();
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        private void InitializeEncoderBasedFileName()
        {
            string fileNameEncoderExtension = PathUtil.GetExtensionSave(FileName);

            if (fileNameEncoderExtension != Extension)
            {
                EncoderBasedFileName = FileName + Extension;
            }
            else
            {
                EncoderBasedFileName = FileName;
            }
        }

        #endregion
    }
}
